#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdbool.h>
//  Definition for singly-linked list.
 struct ListNode {
     int val;
      struct ListNode *next;
  };
 
 typedef struct ListNode ListNode;

bool hasCycle(struct ListNode* head) {
    ListNode* fast = head, * slow = head;
    while (fast && fast->next)
    {
        if (fast == slow)
        {
            return true;
        }
        fast->next->next;
        slow->next;
       
    }
    return false;

}